package com.itboye.mengwu.data.presenter;

import java.util.List;
import java.util.Observer;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.object.BasePresenter;
import com.itboye.core.object.ResultEntity;
import com.itboye.mengwu.app.ui.main.MainPresenter;
import com.itboye.mengwu.data.interfaces.IBaseRepository;
import com.itboye.mengwu.data.interfaces.IMessgeInterface;
import com.itboye.mengwu.data.model.MessgeBean;
import com.itboye.mengwu.data.repository.MessgeRepository;

public class MessgePresenter extends BasePresenter implements
		IBaseRepository<MessgeBean> {

	public static final String MessgeSuccessEvent = MainPresenter.class
			.getName() + "_Messge_success";
	public static final String MessgeFailEvent = MainPresenter.class.getName()
			+ "_Messge_failure";

	public MessgePresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(MessgeBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(MessgeBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(MessgeBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(MessgeBean model) {
		// TODO Auto-generated method stub
		IMessgeInterface<MessgeBean> addGoods = new MessgeRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(MessgeSuccessEvent);
						MessgePresenter.this.setChanged();
						MessgePresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(MessgeFailEvent);
						MessgePresenter.this.setChanged();
						MessgePresenter.this.notifyObservers(result);

					}
				});
		addGoods.getInfo(model);// ("", "", "", "");
	}

	@Override
	public List<MessgeBean> query(MessgeBean model) {
		// TODO Auto-generated method stub
		return null;
	}

}
